#ifndef _CDSF_TASKS_H_
#define _CDSF_TASKS_H_

#include "CDSF_Includes.h"
#include "CDSF_ErrorCode.h"
#include "CDSF_Types.h"

typedef struct {
	SFTaskType type;
	char *name;
	int rate;
	int priority;
	int stackSize;
	SFTaskInitFunction init;
	SFTaskDelegateFunction delegate;
	int counter;
	int semaphore;
	int taskId;
}SFTask;

typedef struct {
	SFTask *tasks;
	int count;
}SFTaskTable;


extern SFCode SFInitTasks(SFTaskTable *taskTable, SFClockRate clockRate);
extern SFCode SFStartTasks(void);
extern void SFClockInterruptHandler(void);
extern void SFTaskRun(SFTask *task);

SFInjection SFCode SFTaskInit(SFTask *task);
SFInjection SFCode SFTaskStart(SFTask *task);
SFInjection void SFTaskWait(SFTask *task);
SFInjection void SFTaskRelease(SFTask *task);

#endif